package cn.hacz.edu.dao;

import cn.hacz.edu.entity.Car;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * The class/interface
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
public interface CarMapper extends BaseMapper<Car> {
    int deleteByPrimaryKey(Integer id);

    int insert(Car record);

    int insertSelective(Car record);

    Car selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Car record);

    int updateByPrimaryKey(Car record);

    @Select(" select t1.name,t2.name as userName,t1.user_id from tb_car t1 left join tb_user_info t2 on t1.user_id=t2.id " +
            " ${ew.customSqlSegment}")
    List<Car> selectCar(@Param(Constants.WRAPPER) Wrapper<Car> carWrapper);

    @Select("select * from tb_car ${ew.customSqlSegment}")
    List<Car> getAll(@Param(Constants.WRAPPER) Wrapper<Car> wrapper);
}
